/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Admission;
import Academic.AcademicBean;
import Address.AddressBean;
import Category.CategoryBean;
import Country.CountryBean;
import Course.CourseBean;
import Facility.FacilityBean;
import Parents.ParentsBean;
import State.StateBean;
import Student.StudentBean;
import java.sql.*;
import java.util.Vector;

/**
 *
 * @author mishra
 */
public class Query {
    static Connection con=null;
    public static int add(AdmissionBean ab) throws SQLException
    {
        int i=0,k=0;
        try{
            con=DBConnection.Connection.getConnection();
            PreparedStatement pre=con.prepareStatement("insert into admission values(admissionid.nextval,?,?,?,?,?,?,?,sysdate,?,?)");
            pre.setString(1, ab.getStudentEmail());
            pre.setString(2, ab.getStudentMobile());
            pre.setString(3, ab.getRollNumber());
            pre.setString(4, ab.getStudentSession());
            pre.setInt(5, ab.getCourseId());
            pre.setString(6, ab.getApplicationNo());
            pre.setDate(7, ab.getAdmissionDate());
            pre.setString(8, ab.getEntryEmail());
            pre.setInt(9,1);
            i=pre.executeUpdate();
            if(i!=0)
            {
                k=getMaxId();
            }
            
        }catch(Exception e)
        {return k;}
        finally{con.close();}
        return k;
    }
public static int getMaxId() throws SQLException
{
    int i=0;
    try{
      con=DBConnection.Connection.getConnection();
      PreparedStatement pre=con.prepareStatement("select max(admission_id) from admission");
      ResultSet rs=pre.executeQuery();
      if(rs.next())
      {
          i=rs.getInt(1);
      }
    }catch(Exception e)
    {return i;}
    finally{con.close();}
    return i;
}
public static Vector viewAll() throws SQLException
{
    Vector<Object> list=new Vector<Object>();
    try
    {
        con=DBConnection.Connection.getConnection();
        PreparedStatement pre=con.prepareStatement("select * from admission left join course on admission.course_id=course.course_id left join student on admission.admission_id=student.admission_id left join address a1 on student.address_id=a1.address_id left join country c1 on a1.country_id=c1.country_id left join state s1 on a1.state_id=s1.state_id left join category on student.category_id=category.category_id left join parents on admission.admission_id=parents.admission_id left join address on parents.address_id=address.address_id left join country on address.country_id=country.country_id left join state on address.state_id=state.state_id left join academic on admission.admission_id=academic.admission_id left join facility on admission.admission_id=facility.admission_id");
        ResultSet rs=pre.executeQuery();
        while(rs.next())
        {
            AdmissionBean ab=new AdmissionBean();
            CourseBean cb=new CourseBean();
            StudentBean sb=new StudentBean();
            AddressBean adb=new AddressBean();
            CountryBean cob=new CountryBean();
            StateBean stb=new StateBean();
            CategoryBean cab=new CategoryBean();
            ParentsBean pb=new ParentsBean();
            AddressBean abp=new AddressBean();
            CountryBean cbp=new CountryBean();
            StateBean sbp=new StateBean();
            AcademicBean acb=new AcademicBean();
            FacilityBean fb=new FacilityBean();
            ab.setAddmissionId(rs.getInt(1));
            ab.setStudentEmail(rs.getString(2));
            ab.setStudentMobile(rs.getString(3));
            ab.setRollNumber(rs.getString(4));
            ab.setStudentSession(rs.getString(5));
            ab.setCourseId(rs.getInt(6));
            ab.setApplicationNo(rs.getString(7));
            ab.setAdmissionDate(rs.getDate(8));
            ab.setEntryDate(rs.getDate(9));
            ab.setEntryEmail(rs.getString(10));
            ab.setSemester(rs.getInt(11));
            cb.setCourseId(rs.getInt(12));
            cb.setCourseName(rs.getString(13));
            cb.setCourseType(rs.getInt(14));
            cb.setCoursePeriod(rs.getInt(15));
            cb.setStream(rs.getString(16));
            cb.setEntryDate(rs.getDate(17));
            ab.setCourseBean(cb);
            sb.setStudentId(rs.getInt(18));
            sb.setAdmissionId(rs.getInt(19));
            sb.setStudentName(rs.getString(20));
            sb.setGender(rs.getString(21));
            sb.setAddressId(rs.getInt(22));
            sb.setEntryDate(rs.getDate(23));
            sb.setCategoryId(rs.getInt(24));
            sb.setPhotoName(rs.getString(25));
            sb.setEntryEmail(rs.getString(26));
            adb.setAddressId(rs.getInt(28));
            adb.setAddress1(rs.getString(29));
            adb.setAddress2(rs.getString(30));
            adb.setCountryId(rs.getInt(31));
            adb.setStateId(rs.getInt(32));
            adb.setPinCode(rs.getString(33));
            adb.setEntryDate(rs.getDate(34));
            cob.setCountryId(rs.getInt(35));
            cob.setCountryName(rs.getString(36));
            cob.setEntryDate(rs.getDate(37));
            stb.setCountryBean(cob);
            stb.setStateId(rs.getInt(38));
            stb.setCountryId(rs.getInt(39));
            stb.setStateName(rs.getString(40));
            stb.setEntryDate(rs.getDate(41));
            adb.setStateBean(stb);
            sb.setAddressBean(adb);
            ab.setStudentBean(sb);
            cab.setCategoryId(rs.getInt(42));
            cab.setCategory(rs.getString(43));
            cab.setEntryDate(rs.getDate(44));
            ab.setCategoryBean(cab);
            pb.setParentId(rs.getInt(45));
            pb.setFatherName(rs.getString(46));
            pb.setFatherMobileNo(rs.getString(47));
            pb.setMotherName(rs.getString(48));
            pb.setMotherMobileNo(rs.getString(49));
            pb.setFatherOccupation(rs.getString(50));
            pb.setMotherOccupation(rs.getString(51));
            pb.setGuardianName(rs.getString(52));
            pb.setRelation(rs.getString(53));
            pb.setGuardianOccupation(rs.getString(54));
            pb.setGuardianMobileNo(rs.getString(55));
            pb.setEntryDate(rs.getDate(56));
            pb.setAddressId(rs.getInt(57));
            pb.setAdmissionId(rs.getInt(58));
            pb.setEntryEmail(rs.getString(59));
            abp.setAddressId(rs.getInt(60));
            abp.setAddress1(rs.getString(61));
            abp.setAddress2(rs.getString(62));
            abp.setCountryId(rs.getInt(63));
            abp.setStateId(rs.getInt(64));
            abp.setPinCode(rs.getString(65));
            abp.setEntryDate(rs.getDate(66));
            
            cbp.setCountryId(rs.getInt(67));
            cbp.setCountryName(rs.getString(68));
            cbp.setEntryDate(rs.getDate(69));
            
            sbp.setStateId(rs.getInt(70));
            sbp.setCountryId(rs.getInt(71));
            sbp.setStateName(rs.getString(72));
            sbp.setEntryDate(rs.getDate(73));
            
            abp.setCountryBean(cbp);
            abp.setStateBean(sbp);
            
            pb.setAddressBean(abp);
            ab.setParentsBean(pb);
            acb.setAcademicId(rs.getInt(74));
            acb.setAddissionId(rs.getInt(75));
            acb.setHighSchool(rs.getString(76));
            acb.setHighBoardName(rs.getString(77));
            acb.setHighMaxMarks(rs.getInt(78));
            acb.setHighMarksObtained(rs.getInt(79));
            acb.setInterSchool(rs.getString(80));
            acb.setInterBoardName(rs.getString(81));
            acb.setInterMaxMarks(rs.getInt(82));
            acb.setInterMarksObtained(rs.getInt(83));
            acb.setOther(rs.getString(84));
            acb.setOtherBoardName(rs.getString(85));
            acb.setOtherMaxMarks(rs.getInt(86));
            acb.setOhterMarksObtained(rs.getInt(87));
            acb.setEntryDate(rs.getDate(88));
            ab.setAcademicBean(acb);
            fb.setFacilityId(rs.getInt(89));
            fb.setTransportationStatus(rs.getInt(90));
            fb.setHostelStatus(rs.getInt(91));
            fb.setMessStatus(rs.getInt(92));
            fb.setAdmissionId(rs.getInt(93));
            fb.setEntryEmail(rs.getString(94));
            ab.setFacilityBean(fb);
            list.add(ab);
        }
    }catch(Exception e)
    {
        //return list;
        System.out.println(e);
    }
    finally
    {
        con.close();
    }
    return list;
}
public static Vector viewAll(String course) throws SQLException
{
    Vector<Object> list=new Vector<Object>();
    try
    {
        con=DBConnection.Connection.getConnection();
        PreparedStatement pre=con.prepareStatement("select * from admission left join course on admission.course_id=course.course_id left join student on admission.admission_id=student.admission_id left join address a1 on student.address_id=a1.address_id left join country c1 on a1.country_id=c1.country_id left join state s1 on a1.state_id=s1.state_id left join category on student.category_id=category.category_id left join parents on admission.admission_id=parents.admission_id left join address on parents.address_id=address.address_id left join country on address.country_id=country.country_id left join state on address.state_id=state.state_id left join academic on admission.admission_id=academic.admission_id left join facility on admission.admission_id=facility.admission_id where course_name=?");
        pre.setString(1, course);
        ResultSet rs=pre.executeQuery();
        while(rs.next())
        {
            AdmissionBean ab=new AdmissionBean();
            CourseBean cb=new CourseBean();
            StudentBean sb=new StudentBean();
            AddressBean adb=new AddressBean();
            CountryBean cob=new CountryBean();
            StateBean stb=new StateBean();
            CategoryBean cab=new CategoryBean();
            ParentsBean pb=new ParentsBean();
            AddressBean abp=new AddressBean();
            CountryBean cbp=new CountryBean();
            StateBean sbp=new StateBean();
            AcademicBean acb=new AcademicBean();
            FacilityBean fb=new FacilityBean();
            ab.setAddmissionId(rs.getInt(1));
            ab.setStudentEmail(rs.getString(2));
            ab.setStudentMobile(rs.getString(3));
            ab.setRollNumber(rs.getString(4));
            ab.setStudentSession(rs.getString(5));
            ab.setCourseId(rs.getInt(6));
            ab.setApplicationNo(rs.getString(7));
            ab.setAdmissionDate(rs.getDate(8));
            ab.setEntryDate(rs.getDate(9));
            ab.setEntryEmail(rs.getString(10));
            ab.setSemester(rs.getInt(11));
            cb.setCourseId(rs.getInt(12));
            cb.setCourseName(rs.getString(13));
            cb.setCourseType(rs.getInt(14));
            cb.setCoursePeriod(rs.getInt(15));
            cb.setStream(rs.getString(16));
            cb.setEntryDate(rs.getDate(17));
            ab.setCourseBean(cb);
            sb.setStudentId(rs.getInt(18));
            sb.setAdmissionId(rs.getInt(19));
            sb.setStudentName(rs.getString(20));
            sb.setGender(rs.getString(21));
            sb.setAddressId(rs.getInt(22));
            sb.setEntryDate(rs.getDate(23));
            sb.setCategoryId(rs.getInt(24));
            sb.setPhotoName(rs.getString(25));
            sb.setEntryEmail(rs.getString(26));
            adb.setAddressId(rs.getInt(28));
            adb.setAddress1(rs.getString(29));
            adb.setAddress2(rs.getString(30));
            adb.setCountryId(rs.getInt(31));
            adb.setStateId(rs.getInt(32));
            adb.setPinCode(rs.getString(33));
            adb.setEntryDate(rs.getDate(34));
            cob.setCountryId(rs.getInt(35));
            cob.setCountryName(rs.getString(36));
            cob.setEntryDate(rs.getDate(37));
            stb.setCountryBean(cob);
            stb.setStateId(rs.getInt(38));
            stb.setCountryId(rs.getInt(39));
            stb.setStateName(rs.getString(40));
            stb.setEntryDate(rs.getDate(41));
            adb.setStateBean(stb);
            sb.setAddressBean(adb);
            ab.setStudentBean(sb);
            cab.setCategoryId(rs.getInt(42));
            cab.setCategory(rs.getString(43));
            cab.setEntryDate(rs.getDate(44));
            ab.setCategoryBean(cab);
            pb.setParentId(rs.getInt(45));
            pb.setFatherName(rs.getString(46));
            pb.setFatherMobileNo(rs.getString(47));
            pb.setMotherName(rs.getString(48));
            pb.setMotherMobileNo(rs.getString(49));
            pb.setFatherOccupation(rs.getString(50));
            pb.setMotherOccupation(rs.getString(51));
            pb.setGuardianName(rs.getString(52));
            pb.setRelation(rs.getString(53));
            pb.setGuardianOccupation(rs.getString(54));
            pb.setGuardianMobileNo(rs.getString(55));
            pb.setEntryDate(rs.getDate(56));
            pb.setAddressId(rs.getInt(57));
            pb.setAdmissionId(rs.getInt(58));
            pb.setEntryEmail(rs.getString(59));
            abp.setAddressId(rs.getInt(60));
            abp.setAddress1(rs.getString(61));
            abp.setAddress2(rs.getString(62));
            abp.setCountryId(rs.getInt(63));
            abp.setStateId(rs.getInt(64));
            abp.setPinCode(rs.getString(65));
            abp.setEntryDate(rs.getDate(66));
            
            cbp.setCountryId(rs.getInt(67));
            cbp.setCountryName(rs.getString(68));
            cbp.setEntryDate(rs.getDate(69));
            
            sbp.setStateId(rs.getInt(70));
            sbp.setCountryId(rs.getInt(71));
            sbp.setStateName(rs.getString(72));
            sbp.setEntryDate(rs.getDate(73));
            
            abp.setCountryBean(cbp);
            abp.setStateBean(sbp);
            
            pb.setAddressBean(abp);
            ab.setParentsBean(pb);
            acb.setAcademicId(rs.getInt(74));
            acb.setAddissionId(rs.getInt(75));
            acb.setHighSchool(rs.getString(76));
            acb.setHighBoardName(rs.getString(77));
            acb.setHighMaxMarks(rs.getInt(78));
            acb.setHighMarksObtained(rs.getInt(79));
            acb.setInterSchool(rs.getString(80));
            acb.setInterBoardName(rs.getString(81));
            acb.setInterMaxMarks(rs.getInt(82));
            acb.setInterMarksObtained(rs.getInt(83));
            acb.setOther(rs.getString(84));
            acb.setOtherBoardName(rs.getString(85));
            acb.setOtherMaxMarks(rs.getInt(86));
            acb.setOhterMarksObtained(rs.getInt(87));
            acb.setEntryDate(rs.getDate(88));
            ab.setAcademicBean(acb);
            fb.setFacilityId(rs.getInt(89));
            fb.setTransportationStatus(rs.getInt(90));
            fb.setHostelStatus(rs.getInt(91));
            fb.setMessStatus(rs.getInt(92));
            fb.setAdmissionId(rs.getInt(93));
            fb.setEntryEmail(rs.getString(94));
            ab.setFacilityBean(fb);
            list.add(ab);
        }
    }catch(Exception e)
    {
        //return list;
        System.out.println(e);
    }
    finally
    {
        con.close();
    }
    return list;
}
public static Vector viewAll(int stream) throws SQLException
{
    Vector<Object> list=new Vector<Object>();
    try
    {
        con=DBConnection.Connection.getConnection();
        PreparedStatement pre=con.prepareStatement("select * from admission left join course on admission.course_id=course.course_id left join student on admission.admission_id=student.admission_id left join address a1 on student.address_id=a1.address_id left join country c1 on a1.country_id=c1.country_id left join state s1 on a1.state_id=s1.state_id left join category on student.category_id=category.category_id left join parents on admission.admission_id=parents.admission_id left join address on parents.address_id=address.address_id left join country on address.country_id=country.country_id left join state on address.state_id=state.state_id left join academic on admission.admission_id=academic.admission_id left join facility on admission.admission_id=facility.admission_id where course.course_id=?");
        pre.setInt(1, stream);
        ResultSet rs=pre.executeQuery();
        while(rs.next())
        {
            AdmissionBean ab=new AdmissionBean();
            CourseBean cb=new CourseBean();
            StudentBean sb=new StudentBean();
            AddressBean adb=new AddressBean();
            CountryBean cob=new CountryBean();
            StateBean stb=new StateBean();
            CategoryBean cab=new CategoryBean();
            ParentsBean pb=new ParentsBean();
            AddressBean abp=new AddressBean();
            CountryBean cbp=new CountryBean();
            StateBean sbp=new StateBean();
            AcademicBean acb=new AcademicBean();
            FacilityBean fb=new FacilityBean();
            ab.setAddmissionId(rs.getInt(1));
            ab.setStudentEmail(rs.getString(2));
            ab.setStudentMobile(rs.getString(3));
            ab.setRollNumber(rs.getString(4));
            ab.setStudentSession(rs.getString(5));
            ab.setCourseId(rs.getInt(6));
            ab.setApplicationNo(rs.getString(7));
            ab.setAdmissionDate(rs.getDate(8));
            ab.setEntryDate(rs.getDate(9));
            ab.setEntryEmail(rs.getString(10));
            ab.setSemester(rs.getInt(11));
            cb.setCourseId(rs.getInt(12));
            cb.setCourseName(rs.getString(13));
            cb.setCourseType(rs.getInt(14));
            cb.setCoursePeriod(rs.getInt(15));
            cb.setStream(rs.getString(16));
            cb.setEntryDate(rs.getDate(17));
            ab.setCourseBean(cb);
            sb.setStudentId(rs.getInt(18));
            sb.setAdmissionId(rs.getInt(19));
            sb.setStudentName(rs.getString(20));
            sb.setGender(rs.getString(21));
            sb.setAddressId(rs.getInt(22));
            sb.setEntryDate(rs.getDate(23));
            sb.setCategoryId(rs.getInt(24));
            sb.setPhotoName(rs.getString(25));
            sb.setEntryEmail(rs.getString(26));
            adb.setAddressId(rs.getInt(28));
            adb.setAddress1(rs.getString(29));
            adb.setAddress2(rs.getString(30));
            adb.setCountryId(rs.getInt(31));
            adb.setStateId(rs.getInt(32));
            adb.setPinCode(rs.getString(33));
            adb.setEntryDate(rs.getDate(34));
            cob.setCountryId(rs.getInt(35));
            cob.setCountryName(rs.getString(36));
            cob.setEntryDate(rs.getDate(37));
            stb.setCountryBean(cob);
            stb.setStateId(rs.getInt(38));
            stb.setCountryId(rs.getInt(39));
            stb.setStateName(rs.getString(40));
            stb.setEntryDate(rs.getDate(41));
            adb.setStateBean(stb);
            sb.setAddressBean(adb);
            ab.setStudentBean(sb);
            cab.setCategoryId(rs.getInt(42));
            cab.setCategory(rs.getString(43));
            cab.setEntryDate(rs.getDate(44));
            ab.setCategoryBean(cab);
            pb.setParentId(rs.getInt(45));
            pb.setFatherName(rs.getString(46));
            pb.setFatherMobileNo(rs.getString(47));
            pb.setMotherName(rs.getString(48));
            pb.setMotherMobileNo(rs.getString(49));
            pb.setFatherOccupation(rs.getString(50));
            pb.setMotherOccupation(rs.getString(51));
            pb.setGuardianName(rs.getString(52));
            pb.setRelation(rs.getString(53));
            pb.setGuardianOccupation(rs.getString(54));
            pb.setGuardianMobileNo(rs.getString(55));
            pb.setEntryDate(rs.getDate(56));
            pb.setAddressId(rs.getInt(57));
            pb.setAdmissionId(rs.getInt(58));
            pb.setEntryEmail(rs.getString(59));
            abp.setAddressId(rs.getInt(60));
            abp.setAddress1(rs.getString(61));
            abp.setAddress2(rs.getString(62));
            abp.setCountryId(rs.getInt(63));
            abp.setStateId(rs.getInt(64));
            abp.setPinCode(rs.getString(65));
            abp.setEntryDate(rs.getDate(66));
            
            cbp.setCountryId(rs.getInt(67));
            cbp.setCountryName(rs.getString(68));
            cbp.setEntryDate(rs.getDate(69));
            
            sbp.setStateId(rs.getInt(70));
            sbp.setCountryId(rs.getInt(71));
            sbp.setStateName(rs.getString(72));
            sbp.setEntryDate(rs.getDate(73));
            
            abp.setCountryBean(cbp);
            abp.setStateBean(sbp);
            
            pb.setAddressBean(abp);
            ab.setParentsBean(pb);
            acb.setAcademicId(rs.getInt(74));
            acb.setAddissionId(rs.getInt(75));
            acb.setHighSchool(rs.getString(76));
            acb.setHighBoardName(rs.getString(77));
            acb.setHighMaxMarks(rs.getInt(78));
            acb.setHighMarksObtained(rs.getInt(79));
            acb.setInterSchool(rs.getString(80));
            acb.setInterBoardName(rs.getString(81));
            acb.setInterMaxMarks(rs.getInt(82));
            acb.setInterMarksObtained(rs.getInt(83));
            acb.setOther(rs.getString(84));
            acb.setOtherBoardName(rs.getString(85));
            acb.setOtherMaxMarks(rs.getInt(86));
            acb.setOhterMarksObtained(rs.getInt(87));
            acb.setEntryDate(rs.getDate(88));
            ab.setAcademicBean(acb);
            fb.setFacilityId(rs.getInt(89));
            fb.setTransportationStatus(rs.getInt(90));
            fb.setHostelStatus(rs.getInt(91));
            fb.setMessStatus(rs.getInt(92));
            fb.setAdmissionId(rs.getInt(93));
            fb.setEntryEmail(rs.getString(94));
            ab.setFacilityBean(fb);
            list.add(ab);
        }
    }catch(Exception e)
    {
        //return list;
        System.out.println(e);
    }
    finally
    {
        con.close();
    }
    return list;
}
public static int edit(AdmissionBean ab) throws SQLException
    {
        int i=0,k=0;
        try{
            con=DBConnection.Connection.getConnection();
            PreparedStatement pre=con.prepareStatement("update admission set STUDENT_EMAIL=?,STUDENT_MOBILE=?,ROLL_NUMBER=?,STUDENT_SESSION=?,COURSE_ID=?,APPLICATION_NO=?, ADMISSION_DATE=?, ENTRY_DATE=sysdate, ENTRY_EMAIL=? where ADMISSION_ID=?");
            pre.setString(1, ab.getStudentEmail());
            pre.setString(2, ab.getStudentMobile());
            pre.setString(3, ab.getRollNumber());
            pre.setString(4, ab.getStudentSession());
            pre.setInt(5, ab.getCourseId());
            pre.setString(6, ab.getApplicationNo());
            pre.setDate(7, ab.getAdmissionDate());
            pre.setString(8, ab.getEntryEmail());
            pre.setInt(9, ab.getAddmissionId());
            i=pre.executeUpdate();
        }catch(Exception e)
        {return i;}
        finally{con.close();}
        return i;
    }
public static int getAdmiId(String email)throws SQLException{
    int aid=0;
    try{
        con=DBConnection.Connection.getConnection();
        PreparedStatement pre=con.prepareStatement("select ADMISSION_ID from admission where STUDENT_EMAIL=?");
        pre.setString(1, email);
        ResultSet rs=pre.executeQuery();
        while(rs.next()){
        aid=rs.getInt(1);
        }
    }catch(Exception e){
        return aid;
    }finally{
        con.close();
    }return aid;
}
public static AdmissionBean viewSpecific(int id) throws SQLException
{
    AdmissionBean ab=new AdmissionBean();
    try
    {
        con=DBConnection.Connection.getConnection();
        PreparedStatement pre=con.prepareStatement("select * from admission a left join course c on a.course_id=c.course_id where a.admission_id=?");
        pre.setInt(1, id);
        ResultSet rs=pre.executeQuery();
        while(rs.next())
        {
            
            CourseBean cb=new CourseBean();
            
            ab.setAddmissionId(rs.getInt(1));
            ab.setStudentEmail(rs.getString(2));
            ab.setStudentMobile(rs.getString(3));
            ab.setRollNumber(rs.getString(4));
            ab.setStudentSession(rs.getString(5));
            ab.setCourseId(rs.getInt(6));
            ab.setApplicationNo(rs.getString(7));
            ab.setAdmissionDate(rs.getDate(8));
            ab.setEntryDate(rs.getDate(9));
            ab.setEntryEmail(rs.getString(10));
            ab.setSemester(rs.getInt(11));
            cb.setCourseId(rs.getInt(12));
            cb.setCourseName(rs.getString(13));
            cb.setCourseType(rs.getInt(14));
            cb.setCoursePeriod(rs.getInt(15));
            cb.setStream(rs.getString(16));
            cb.setEntryDate(rs.getDate(17));
            ab.setCourseBean(cb);
            
        }
    }catch(Exception e)
    {
        //return list;
        System.out.println(e);
    }
    finally
    {
        con.close();
    }
    return ab;
}
public static AdmissionBean viewSpecificforstu(int admId) throws SQLException
{
    AdmissionBean ab=new AdmissionBean();
    try
    {
        con=DBConnection.Connection.getConnection();
        PreparedStatement pre=con.prepareStatement("select * from admission left join course on admission.course_id=course.course_id left join student on admission.admission_id=student.admission_id left join address a1 on student.address_id=a1.address_id left join country c1 on a1.country_id=c1.country_id left join state s1 on a1.state_id=s1.state_id left join category on student.category_id=category.category_id left join parents on admission.admission_id=parents.admission_id left join address on parents.address_id=address.address_id left join country on address.country_id=country.country_id left join state on address.state_id=state.state_id left join academic on admission.admission_id=academic.admission_id left join facility on admission.admission_id=facility.admission_id where admission.ADMISSION_ID=?");
        pre.setInt(1, admId);
        ResultSet rs=pre.executeQuery();
        while(rs.next())
        {
            
            CourseBean cb=new CourseBean();
            StudentBean sb=new StudentBean();
            AddressBean adb=new AddressBean();
            CountryBean cob=new CountryBean();
            StateBean stb=new StateBean();
            CategoryBean cab=new CategoryBean();
            ParentsBean pb=new ParentsBean();
            AddressBean abp=new AddressBean();
            CountryBean cbp=new CountryBean();
            StateBean sbp=new StateBean();
            AcademicBean acb=new AcademicBean();
            FacilityBean fb=new FacilityBean();
            ab.setAddmissionId(rs.getInt(1));
            ab.setStudentEmail(rs.getString(2));
            ab.setStudentMobile(rs.getString(3));
            ab.setRollNumber(rs.getString(4));
            ab.setStudentSession(rs.getString(5));
            ab.setCourseId(rs.getInt(6));
            ab.setApplicationNo(rs.getString(7));
            ab.setAdmissionDate(rs.getDate(8));
            ab.setEntryDate(rs.getDate(9));
            ab.setEntryEmail(rs.getString(10));
            ab.setSemester(rs.getInt(11));
            cb.setCourseId(rs.getInt(12));
            cb.setCourseName(rs.getString(13));
            cb.setCourseType(rs.getInt(14));
            cb.setCoursePeriod(rs.getInt(15));
            cb.setStream(rs.getString(16));
            cb.setEntryDate(rs.getDate(17));
            ab.setCourseBean(cb);
            sb.setStudentId(rs.getInt(18));
            sb.setAdmissionId(rs.getInt(19));
            sb.setStudentName(rs.getString(20));
            sb.setGender(rs.getString(21));
            sb.setAddressId(rs.getInt(22));
            sb.setEntryDate(rs.getDate(23));
            sb.setCategoryId(rs.getInt(24));
            sb.setPhotoName(rs.getString(25));
            sb.setEntryEmail(rs.getString(26));
            adb.setAddressId(rs.getInt(28));
            adb.setAddress1(rs.getString(29));
            adb.setAddress2(rs.getString(30));
            adb.setCountryId(rs.getInt(31));
            adb.setStateId(rs.getInt(32));
            adb.setPinCode(rs.getString(33));
            adb.setEntryDate(rs.getDate(34));
            cob.setCountryId(rs.getInt(35));
            cob.setCountryName(rs.getString(36));
            cob.setEntryDate(rs.getDate(37));
            stb.setCountryBean(cob);
            stb.setStateId(rs.getInt(38));
            stb.setCountryId(rs.getInt(39));
            stb.setStateName(rs.getString(40));
            stb.setEntryDate(rs.getDate(41));
            adb.setStateBean(stb);
            sb.setAddressBean(adb);
            ab.setStudentBean(sb);
            cab.setCategoryId(rs.getInt(42));
            cab.setCategory(rs.getString(43));
            cab.setEntryDate(rs.getDate(44));
            ab.setCategoryBean(cab);
            pb.setParentId(rs.getInt(45));
            pb.setFatherName(rs.getString(46));
            pb.setFatherMobileNo(rs.getString(47));
            pb.setMotherName(rs.getString(48));
            pb.setMotherMobileNo(rs.getString(49));
            pb.setFatherOccupation(rs.getString(50));
            pb.setMotherOccupation(rs.getString(51));
            pb.setGuardianName(rs.getString(52));
            pb.setRelation(rs.getString(53));
            pb.setGuardianOccupation(rs.getString(54));
            pb.setGuardianMobileNo(rs.getString(55));
            pb.setEntryDate(rs.getDate(56));
            pb.setAddressId(rs.getInt(57));
            pb.setAdmissionId(rs.getInt(58));
            pb.setEntryEmail(rs.getString(59));
            abp.setAddressId(rs.getInt(60));
            abp.setAddress1(rs.getString(61));
            abp.setAddress2(rs.getString(62));
            abp.setCountryId(rs.getInt(63));
            abp.setStateId(rs.getInt(64));
            abp.setPinCode(rs.getString(65));
            abp.setEntryDate(rs.getDate(66));
            
            cbp.setCountryId(rs.getInt(67));
            cbp.setCountryName(rs.getString(68));
            cbp.setEntryDate(rs.getDate(69));
            
            sbp.setStateId(rs.getInt(70));
            sbp.setCountryId(rs.getInt(71));
            sbp.setStateName(rs.getString(72));
            sbp.setEntryDate(rs.getDate(73));
            
            abp.setCountryBean(cbp);
            abp.setStateBean(sbp);
            
            pb.setAddressBean(abp);
            ab.setParentsBean(pb);
            acb.setAcademicId(rs.getInt(74));
            acb.setAddissionId(rs.getInt(75));
            acb.setHighSchool(rs.getString(76));
            acb.setHighBoardName(rs.getString(77));
            acb.setHighMaxMarks(rs.getInt(78));
            acb.setHighMarksObtained(rs.getInt(79));
            acb.setInterSchool(rs.getString(80));
            acb.setInterBoardName(rs.getString(81));
            acb.setInterMaxMarks(rs.getInt(82));
            acb.setInterMarksObtained(rs.getInt(83));
            acb.setOther(rs.getString(84));
            acb.setOtherBoardName(rs.getString(85));
            acb.setOtherMaxMarks(rs.getInt(86));
            acb.setOhterMarksObtained(rs.getInt(87));
            acb.setEntryDate(rs.getDate(88));
            ab.setAcademicBean(acb);
            fb.setFacilityId(rs.getInt(89));
            fb.setTransportationStatus(rs.getInt(90));
            fb.setHostelStatus(rs.getInt(91));
            fb.setMessStatus(rs.getInt(92));
            fb.setAdmissionId(rs.getInt(93));
            fb.setEntryEmail(rs.getString(94));
            ab.setFacilityBean(fb);
        }
    }catch(Exception e)
    {
        //return list;
        System.out.println(e);
    }
    finally
    {
        con.close();
    }
    return ab;
}
}
